﻿Imports System.Data.SqlClient
Imports System.Configuration.ConfigurationManager
Imports System.Data.Linq

Partial Class controls_ProductList
    Inherits System.Web.UI.UserControl

    Protected _categoryId As String

    Public Property CategoryId() As String
        Get
            Return Me._categoryId
        End Get
        Set(ByVal value As String)
            Me._categoryId = value
        End Set
    End Property

    Public Sub Bind()
        Dim cntx As New GlamUp(ConnectionStrings("GlamUpConnectionString").ConnectionString)

        Dim productList = From prList In cntx.Products _
                        Where prList.categoryId = Me._categoryId _
                        Select prList
        For Each prod In productList
            Dim id As String = prod.brandId
        Next

        rptProductList.DataSource = productList
        rptProductList.DataBind()


        rptBrands.DataSource = cntx.GetAvailableBrands(Me._categoryId)
        rptBrands.DataBind()
    End Sub

End Class


